package com.ty.day6;

import java.util.Arrays;
import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 * Author : txy
 * Create 2023/11/2 15:18
 */
public class Two {
    public static void main(String[] args) {
        int[] a = new int[10];
        Random random = new Random();
        for (int i = 0; i < a.length; i++) {
            a[i] = random.nextInt(100) + 1;
        }
        System.out.println("排序前：\n" + Arrays.toString(a));
        int t;
        for (int i = 0; i < a.length - 1; i++) {
            for (int j = i + 1; j < a.length; j++) {
                if (a[i] > a[j]) {
                    t = a[i];
                    a[i] = a[j];
                    a[j] = t;
                }
            }
        }
        System.out.println("排序后：\n" + Arrays.toString(a));
    }
}
